<?php

namespace App\Models;

use Illuminate\Support\Facades\DB;

class UserLevel extends Base
{
    //获取等级列表
    public function getPageList($options=[],$where=[],$whereDates){
        try{
            $limit = (isset($options['limit']) && $options['limit']) ? $options['limit'] : 1;
            $page = (isset($options['page']) && $options['page']) ? $options['page'] : 1;
            $model = $this->where($where);
            if(!empty($whereDates)){
                $model = $model->whereDate('created_at','>=',$whereDates[0])->whereDate('created_at','<',$whereDates[1]);
            }
            $model=$model->orderBy('min');
            $result = $this->paging($model,$page,$limit);
            return $result;
        }catch (\Exception $e){
            return [
                'code'=>1,
                'message'=>$e->getMessage()
            ];
        }
    }

}
